#include <ut/UnitTest.h>
#include <illib/Log.h>

using namespace illib;

namespace illib_ut{
	class A{
	protected:
		uint32_t u32_;
		uint8_t u16_;
		const char * string_;
		void * pointer_;
	public:
		A() :
			u32_(69),
			u16_(88),
			string_("yoyoyo"),
			pointer_(0)
		{

		}
		void debug(ConsoleLogger * parent) {
			ObjectLogger logger(parent, SZ(A), this);
			logger.number(EX(u32_));
			logger.number(EX(u16_));
			logger.string(EX(string_));
			logger.pointer(EX(pointer_));
		}
	};

	class B : A{
	protected:
		int32_t i32_;
		bool bool_;
	public:
		B() :
			A(),
			i32_(-69),
			bool_(false)
		{

		}
		void debug(ConsoleLogger * parent) {
			ObjectLogger logger(parent, SZ(B), this);
			logger.number(EX(i32_));
			logger.boolean(EX(bool_));
			A::debug(&logger);
		}
	};

	class C{
	protected:
		A a_;
		B b_;
		A * aptr_;
		B & bref_;
	public:
		C() :
			a_(),
			b_(),
			aptr_(&a_),
			bref_(b_)
		{

		}
		void debug(ConsoleLogger * parent) {
			ObjectLogger logger(parent, SZ(C), this);
			a_.debug(&logger);
			b_.debug(&logger);
			aptr_->debug(&logger);
			bref_.debug(&logger);
		}
	};

	void Log_ut(){
		ut::UnitTestLogger logger(TN(illib_ut::Log_ut));
		A a;
		B b;
		C c;
		ConsoleLogger console(0, "\n", " ");
		a.debug(&console);
		b.debug(&console);
		c.debug(&console);
	}
};
